package org.itboys.core.controller.front.index;

import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import org.itboys.core.dto.index.SundayIndexDTO;
import org.itboys.core.service.mongo.front.SundayFrontStoreService;
import org.itboys.core.util.ResponseMessage;
import org.itboys.framework.spring.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @Author：贾琦磊
 * @Date：2018/12/27
 * @Description：
 */
@Controller
@Api(value = "index",description = "主页")
@RequestMapping("/sunday/mobile/index")
public class SundayFrontIndexController extends BaseController{

    @Autowired
    private SundayFrontStoreService storeService;

    @RequestMapping(value = "/getDate",method = RequestMethod.POST)
    @ApiOperation("获取主页数据")
    public void getDate(HttpServletRequest request, HttpServletResponse response
    , @ApiParam("城市id")@RequestParam(value = "cityId",required = true)Long cityId){
        List<SundayIndexDTO> data = storeService.index(cityId);
        ResponseMessage.success(data);
    }
}
